package com.servicio.panel;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.servicio.styles.Styles;

@SuppressWarnings("serial")
public class PanelPagina1 extends JPanel{
  
  
  private JLabel barrio=new JLabel("Urbanizacion o Barrio: ");
  private JTextField barrioTF=new JTextField(25);
  private JLabel calle=new JLabel("Calle o Pasaje: ");
  private JTextField calleTF=new JTextField(25);
  private JLabel nomNumVivienda=new JLabel("Nombre o Numero de Vivienda: ");
  private JTextField nomNumViviendaTF=new JTextField(25);
  private JLabel telefono=new JLabel("Telefono: ");
  private JTextField telefonoTF=new JTextField(25);
  private JLabel telResidencial=new JLabel("Telefono Residencial: ");
  private JTextField telResidencialTF=new JTextField(25);
  private JLabel ECDOC=new JLabel("¿Es Continuacion de Otra Cuestionario ?:   ");
  private JComboBox ECDOCCB=new JComboBox();
  
  
  
  public PanelPagina1() {
    ECDOCCB.addItem("No");
    ECDOCCB.addItem("Si");
    ECDOCCB.setSelectedIndex(0);
    confEstilos();
    Styles.tamPanel(this, 100, 68);
   this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(panelSeccion1());
    this.add(panelSeccion2());
  }
  
  
  private JPanel panelSeccion1(){
    JLabel titulo1 = new JLabel("SECCION 1: Identificacion de la Estructura");
    Styles.titulo(titulo1,20,20);
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.anchor=GridBagConstraints.WEST;
    JPanel panelPrincipal=new JPanel();
    panelPrincipal.setLayout(new BorderLayout());
    JPanel panelElementos=new JPanel();
    panelElementos.setLayout(gridbag);
    
    barrioTF.setEnabled(false);
    barrioTF.setText(" Andres Eloy Blanco ");
    //........................................
    confGBC(c, 0, 0, 1, 1);
    panelElementos.add(barrio,c);    
    //........................................
    confGBC(c, 1, 0, 1, 1);
    panelElementos.add(barrioTF,c); 
    //........................................
    confGBC(c, 0, 1, 1, 1);
    panelElementos.add(calle,c);    
    //........................................
    confGBC(c, 1, 1, 1, 1);
    panelElementos.add(calleTF,c); 
    //........................................
    confGBC(c, 0, 2, 1, 1);
    panelElementos.add(nomNumVivienda,c); 
    //........................................
    confGBC(c, 1, 2, 1, 1);
    panelElementos.add(nomNumViviendaTF,c); 
    //........................................
    confGBC(c, 0, 3, 1, 1);
    panelElementos.add(telefono,c); 
    //........................................
    confGBC(c, 1, 3, 1, 1);
    panelElementos.add(telefonoTF,c); 
    //........................................
    confGBC(c, 0, 4, 1, 1);
    panelElementos.add(telResidencial,c);
    //........................................
    confGBC(c, 1, 4, 1, 1);
    panelElementos.add(telResidencialTF,c);
    //........................................
    confGBC(c, 0, 5, 1, 1);
    panelElementos.add(ECDOC,c);
    //........................................
    confGBC(c, 1, 5, 1, 1);
    panelElementos.add(ECDOCCB,c);
    
    panelPrincipal.add(titulo1,BorderLayout.NORTH);
    panelPrincipal.add(panelElementos,BorderLayout.WEST);
    
    return panelPrincipal;
    
  }
  
  private JPanel panelSeccion2(){
    JLabel titulo1 = new JLabel("SECCION 2: Identificacion de la Estructura");
    Styles.titulo(titulo1,20,20);
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.anchor=GridBagConstraints.WEST;
    JPanel panelPrincipal=new JPanel();
    panelPrincipal.setLayout(new BorderLayout());
    JPanel panelElementos=new JPanel();
    panelElementos.setLayout(gridbag);
    
    barrioTF.setEnabled(false);
    barrioTF.setText(" Andres Eloy Blanco ");
    //........................................
    confGBC(c, 0, 0, 1, 1);
    panelElementos.add(barrio,c);    
    //........................................
    confGBC(c, 1, 0, 1, 1);
    panelElementos.add(barrioTF,c); 
    //........................................
    confGBC(c, 0, 1, 1, 1);
    panelElementos.add(calle,c);    
    //........................................
    confGBC(c, 1, 1, 1, 1);
    panelElementos.add(calleTF,c); 
    //........................................
    confGBC(c, 0, 2, 1, 1);
    panelElementos.add(nomNumVivienda,c); 
    //........................................
    confGBC(c, 1, 2, 1, 1);
    panelElementos.add(nomNumViviendaTF,c); 
    //........................................
    confGBC(c, 0, 3, 1, 1);
    panelElementos.add(telefono,c); 
    //........................................
    confGBC(c, 1, 3, 1, 1);
    panelElementos.add(telefonoTF,c); 
    //........................................
    confGBC(c, 0, 4, 1, 1);
    panelElementos.add(telResidencial,c);
    //........................................
    confGBC(c, 1, 4, 1, 1);
    panelElementos.add(telResidencialTF,c);
    //........................................
    confGBC(c, 0, 5, 1, 1);
    panelElementos.add(ECDOC,c);
    //........................................
    confGBC(c, 1, 5, 1, 1);
    panelElementos.add(ECDOCCB,c);
    
    panelPrincipal.add(titulo1,BorderLayout.NORTH);
    panelPrincipal.add(panelElementos,BorderLayout.WEST);
    
    return panelPrincipal;
    
  }
  
  private void confEstilos(){
    Styles.textoSesion(barrio,15);
    Styles.textoSesion(calle,15);
    Styles.textoSesion(nomNumVivienda,15);
    Styles.textoSesion(telefono,15);
    Styles.textoSesion(telResidencial,15);
    Styles.textoSesion(ECDOC,15);
  }
  
  private void confGBC(GridBagConstraints c,int gX,int gY, int gW, int gH){
    c.gridx = gX;
    c.gridy = gY;
    c.gridwidth = gW;
    c.gridheight = gH;    
  }

}
